package com.neu.service;

import com.github.pagehelper.PageHelper;
import com.neu.dao.ShoppingSearchHistoryMapper;
import com.neu.domain.ShoppingSearchHistory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShoppingSearchHistoryService {
    @Autowired
    private ShoppingSearchHistoryMapper shoppingSearchHistoryMapper;
    public List<ShoppingSearchHistory> querySelective(String pageSize, String pageNum, Integer userId, String keyword){
       int size = Integer.parseInt(pageSize);
       int num = Integer.parseInt(pageNum);
        PageHelper.startPage(num,size);
        List<ShoppingSearchHistory> searchHistories = shoppingSearchHistoryMapper.selectByExample(userId,keyword);
        if (searchHistories.size() != 0){
            return searchHistories;
        }
        return null;
    }


}
